package com.xgure.interceptor;

import com.xgure.exception.BaseException;
import com.xgure.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局业务异常处理器
 *
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BaseException.class)
    public Result<String> exceptionHandler(BaseException ex){
        return Result.error(ex.getMessage());
    }

}
